package com.hello.system.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hello.common.log.annotation.Log;
import com.hello.common.log.enums.BusinessType;
import com.hello.common.security.annotation.RequiresPermissions;
import com.hello.system.domain.WvpMediaServer;
import com.hello.system.service.IWvpMediaServerService;
import com.hello.common.core.web.controller.BaseController;
import com.hello.common.core.web.domain.AjaxResult;
import com.hello.common.core.utils.poi.ExcelUtil;
import com.hello.common.core.web.page.TableDataInfo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * 流媒体服务器配置Controller
 * 
 * @author hello
 * @date 2025-09-29
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/wvpMediaServer")
public class WvpMediaServerController extends BaseController
{
    private final IWvpMediaServerService wvpMediaServerService;

    /**
     * 查询流媒体服务器配置列表
     */
    @RequiresPermissions("system:wvpMediaServer:list")
    @GetMapping("/list")
    public TableDataInfo list(WvpMediaServer wvpMediaServer)
    {
        startPage();
        List<WvpMediaServer> list = wvpMediaServerService.selectWvpMediaServerList(wvpMediaServer);
        return getDataTable(list);
    }

    /**
     * 导出流媒体服务器配置列表
     */
    @RequiresPermissions("system:wvpMediaServer:export")
    @Log(title = "流媒体服务器配置", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, WvpMediaServer wvpMediaServer)
    {
        List<WvpMediaServer> list = wvpMediaServerService.selectWvpMediaServerList(wvpMediaServer);
        ExcelUtil<WvpMediaServer> util = new ExcelUtil<WvpMediaServer>(WvpMediaServer.class);
        util.exportExcel(response, list, "流媒体服务器配置数据");
    }

    /**
     * 获取流媒体服务器配置详细信息
     */
    @RequiresPermissions("system:wvpMediaServer:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(wvpMediaServerService.selectWvpMediaServerById(id));
    }

    /**
     * 新增流媒体服务器配置
     */
    @RequiresPermissions("system:wvpMediaServer:add")
    @Log(title = "流媒体服务器配置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WvpMediaServer wvpMediaServer)
    {
        return toAjax(wvpMediaServerService.insertWvpMediaServer(wvpMediaServer));
    }

    /**
     * 修改流媒体服务器配置
     */
    @RequiresPermissions("system:wvpMediaServer:edit")
    @Log(title = "流媒体服务器配置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WvpMediaServer wvpMediaServer)
    {
        return toAjax(wvpMediaServerService.updateWvpMediaServer(wvpMediaServer));
    }

    /**
     * 删除流媒体服务器配置
     */
    @RequiresPermissions("system:wvpMediaServer:remove")
    @Log(title = "流媒体服务器配置", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(wvpMediaServerService.deleteWvpMediaServerByIds(ids));
    }
}
